/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package cn.knet.sp.ncrm.modules.customer.potentialcall.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

import org.hibernate.validator.constraints.Length;

import java.util.Date;

import cn.knet.sp.ncrm.common.persistence.DataEntity;
import cn.knet.sp.ncrm.modules.sys.user.entity.User;
import cn.knet.sp.ncrm.modules.sys.utils.UserUtils;

/**
 * 潜在客户呼叫记录Entity
 * @author zhangbin
 * @version 2015-09-01
 */
public class PotentialCall extends DataEntity<PotentialCall> {
	
	private static final long serialVersionUID = 1L;

	private String callId;		// 呼叫中心记录ID
	private String filePath;		// 录音文件路径
	private String fromUserId;		// 当前拨打用户ID
	private String fromUserName;	//用户名称
	private String potentialCustomerId;		// 潜在客户ID
	private String toPhone;		// 拨打电话号码
	private String serviceDirect;		// 呼叫方向由呼叫中心定义
	private Long alertTime;		// 振铃时长,呼入呼出情况下内容不同
	private String disconnectType;		// 挂断方式,1客户挂机2坐席挂机

	private String strStartDate;		// 呼叫开始时间
	private String strEndDate;		// 呼叫结束时间

	private Long callTime;		// 呼叫时长（单位：秒）
	private Date startDate;		// 开始时间
	private Date endDate;		// 结束时间

	private Long version;		// 版本
	private Date dateCreated;		// 记录创建时间
	private Date lastUpdated;		// 最后更新时间


	
	public PotentialCall() {
		super();
	}

	public PotentialCall(String id){
		super(id);
	}

	@Length(min=1, max=255, message="呼叫中心记录ID长度必须介于 1 和 255 之间")
	public String getCallId() {
		return callId;
	}

	public void setCallId(String callId) {
		this.callId = callId;
	}

	@Length(min=1, max=255, message="录音文件路径长度必须介于 1 和 255 之间")
	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	@Length(min=1, max=64, message="当前拨打用户ID长度必须介于 1 和 64 之间")
	public String getFromUserId() {
		return fromUserId;
	}

	public void setFromUserId(String fromUserId) {
		User user = UserUtils.get(fromUserId);
		if(user!=null){
			setFromUserName(user.getName());
		}
		this.fromUserId = fromUserId;
	}

	public String getFromUserName() {
		return fromUserName;
	}

	public void setFromUserName(String fromUserName) {
		this.fromUserName = fromUserName;
	}

	@Length(min=1, max=64, message="潜在客户ID长度必须介于 1 和 64 之间")
	public String getPotentialCustomerId() {
		return potentialCustomerId;
	}

	public void setPotentialCustomerId(String potentialCustomerId) {
		this.potentialCustomerId = potentialCustomerId;
	}

	public String getToPhone() {
		return toPhone;
	}

	public void setToPhone(String toPhone) {
		this.toPhone = toPhone;
	}

	public String getServiceDirect() {
		return serviceDirect;
	}

	public void setServiceDirect(String serviceDirect) {
		this.serviceDirect = serviceDirect;
	}

	public Long getAlertTime() {
		return alertTime;
	}

	public void setAlertTime(Long alertTime) {
		this.alertTime = alertTime;
	}

	public String getDisconnectType() {
		return disconnectType;
	}

	public void setDisconnectType(String disconnectType) {
		this.disconnectType = disconnectType;
	}

	public String getStrStartDate() {
		return strStartDate;
	}

	public void setStrStartDate(String strStartDate) {
		this.strStartDate = strStartDate;
	}

	public String getStrEndDate() {
		return strEndDate;
	}

	public void setStrEndDate(String strEndDate) {
		this.strEndDate = strEndDate;
	}

	public Long getCallTime() {
		return callTime;
	}

	public void setCallTime(Long callTime) {
		this.callTime = callTime;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDateCreated() {
		return dateCreated;
	}

	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getLastUpdated() {
		return lastUpdated;
	}

	public void setLastUpdated(Date lastUpdated) {
		this.lastUpdated = lastUpdated;
	}
}